﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpModelInterface.h"
#include "IEventArgs.h"
#include "ElementId.h"


namespace gcmp
{
    class IDocument;

    /// \brief 表格事件类型
    ///
    /// 
    enum class DrawingTableEventType : int32_t
    {
        PostAddRow = 0,        ///< 表格添加行事件
        PostDeleteRow = 1,     ///< 表格删除行事件
        PostAddColumn = 2,     ///< 表格添加列事件
        PostDeleteColumn = 3,  ///< 表格删除列事件
        PostDataExchanged = 4, ///< 表格行列交换事件
        PostRowHeightChanged = 5,   ///< 表格行高改变事件
        PostColumnWidthChanged = 6, ///< 表格列宽改变事件
        PostMoveItemsRow   = 7, ///< 表格行移动事件
        PostMoveItemsColumn   = 8, ///< 表格列移动事件
        PreAddRow = 9,      ///< 表格行添加前事件
        PreAddColumn = 10,   ///< 表格列添加前事件
        PreDeleteRow = 11,      ///< 表格行删除前事件
        PreDeleteColumn = 12   ///< 表格列删除前事件
    };


    /// \brief  表格事件参数
    ///
    class GCMP_MODEL_INTERFACE_EXPORT IDrawingTableEventArgs : public IEventArgs
    {
        DEFINE_CAST_DERIVED(gcmp::IDrawingTableEventArgs, gcmp::IEventArgs)
    public:

        ///  \brief 获取表格事件类型
        ///
        /// \return 表格事件类型
        virtual DrawingTableEventType GetType() const = 0;

        ///  \brief 获取表格事件对应的文档
        ///
        /// \return 表格事件文档指针
        virtual const IDocument* GetDocument() const = 0;

        ///  \brief 获取表格事件对应的视图Id
        ///
        /// \return 视图Id
        virtual ElementId GetModelViewId() const = 0;

        /// \brief 获取表格事件对应的表格Id
        ///
        /// \return 表格ElementId
        virtual ElementId GetDrawingTableElementId() const = 0;
    };
}